package com.info.widgets.Leave;
import java.util.ArrayList;
import java.util.List;
import java.sql.*;

import com.info.widgets.ConnectionHelper;
import com.info.widgets.DAOException;
import com.info.widgets.FeedBack.FeedBack;
import com.info.widgets.Leave.Leave;
public class LeaveService {
	public ArrayList<Leave> FootprintCreation(Leave foot) throws DAOException{
		System.out.println("LeaveCreation");
		Leave foot1=new Leave();
		Connection con=null;
		String dbtime=null;
		//String query="SELECT * FROM mycaspian.leave_a_footprint";
		ArrayList<Leave> arrayList = new ArrayList<Leave>();
		try {
			con=ConnectionHelper.getConnection();
			Statement stmt=con.createStatement();
			//ResultSet rs=stmt.executeQuery(query);
			PreparedStatement pst = null;
			pst = con.prepareStatement("INSERT INTO Leave (name, email, contactno, discuss)  VALUES(?, ?, ?, ?) ");
			
			
			pst.setString(1,foot.getName());
			pst.setString(2,foot.getEmail());
			pst.setLong(3,foot.getContactno());
			pst.setLong(4, foot.getId());
			pst.executeUpdate();
			} catch (Exception e) {
			e.printStackTrace();
			throw new DAOException(e);
		} finally {
			ConnectionHelper.close(con);
		}
		return arrayList;
}
}